package com.javaweb.annotation.validate.impl;

import com.javaweb.constant.PatternConstant;
import com.javaweb.util.core.StringUtil;

/**
 * IP校验
 * @author tank2140896
 */
public class IpCheck {
	
	/**
	 * IP校验方法
	 * @param ip IP
	 * @return boolean true：校验成功；false：校验失败
	 */
    public static boolean check(String ip){
    	if(StringUtil.isEmpty(ip)){
    		return false;
    	}
    	return PatternConstant.IP_PATTERN.matcher(ip).matches();
    }

}
